<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  website
 */

class m_website_actions_block_front_MenuAction extends f_core_Action
{
	public function execute()
	{
		$blockParameters = $this->getBlockContext()->getParameters();		

        $pageLang = $this->getBlockParameter('pageLang', $this->getContext('currentPage')->getLang());

        ob_start();
		m_website_services_MenuService::getInstance()->getMenu($this->getBlockParameter('menu', $this->getContext('currentWebsite')->getUniqueId()), $pageLang , $this->getBlockParameter('depth'), null, $this->getContext('currentPage'), $this->getBlockParameter('activeParent', false) == '1');
        $menuHtml = ob_get_contents();
        ob_end_clean();

        $this->addToModel('blockParameter', $blockParameters);
        $this->addToModel('menu', $menuHtml);
        $this->addToModel('menuId', $this->getBlockParameter('menu'));
        $this->setView('success');
	}
}